package com.zwxbc.funplay.service.impl;

import com.zwxbc.funplay.dao.PurchaseRecordDao;
import com.zwxbc.funplay.dao.impl.PurchaseRecordDaoImpl;
import com.zwxbc.funplay.entity.PurchaseRecord;
import com.zwxbc.funplay.service.PurchaseRecordService;

import java.util.List;

/**
 * @author Liubuzhu
 */
public class PurchaseRecordServiceImpl implements PurchaseRecordService {
	PurchaseRecordDao purchaseRecordDao = new PurchaseRecordDaoImpl();

	@Override
	public List<PurchaseRecord> getPurchaseRecordList() {
		return purchaseRecordDao.getAllPurchaseRecords();
	}

	@Override
	public boolean deletePurchaseRecord(Long purchaseRecordId) {
		int result = purchaseRecordDao.deletePurchaseRecord(purchaseRecordId);
		return result > 0;
	}

	@Override
	public boolean updatePurchaseRecord(PurchaseRecord purchaseRecord) {
		int result = purchaseRecordDao.updatePurchaseRecord(purchaseRecord);
		return result > 0;
	}

	@Override
	public boolean addPurchaseRecord(PurchaseRecord purchaseRecord) {
		int result = purchaseRecordDao.addPurchaseRecord(purchaseRecord);
		return result > 0;
	}

	@Override
	public PurchaseRecord getPurchaseRecordById(Long purchaseRecordId) {
		return purchaseRecordDao.getPurchaseRecordById(purchaseRecordId);
	}
}
